﻿package com.zit.service;

import java.util.List;

import org.hibernate.Session;
import org.hibernate.Transaction;

import com.zit.dao.TermDAO;
import com.zit.entity.Term;


/**
 * 功能：学期管理
 * @author 唐美兰
 * createTime  2013-12-3
 */
public class TermService extends BaseService {

	private TermDAO termdao = new TermDAO();
	
	/**
	 * 功能：查询所有学期
	 * @return
	 */
	public List<Term> showterm() {
		List<Term> list = super.findAll(Term.class);
		return list;
	}

	/**
	 * 功能：添加学期：
	 * @param t
	 */
	public void addterm(Term t){
		Session s = null;
		Transaction tx = null ;
		try {
			s = getSession();
			tx = s.beginTransaction();
			termdao.addTerm(s, t);
			tx.commit();
		} catch (Exception e) {
			e.printStackTrace();
		}finally{
			s.close();
		}	
	}
	
}
